Properties props = new Properties();
props.put("acks", "all"); // 確切一次
props.put("bootstrap.servers", "your_kafka_broker");
props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
Producer<String, String> producer = new KafkaProducer<>(props);
先卡